package com.zeekr.shardingsphere.mapper;

import com.zeekr.shardingsphere.bean.Orders;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author yangyuanping
 */

@Mapper
public interface OrdersMapper {

    @Insert("insert into orders(order_type,customer_id,amount) values(#{orderType},#{customerId},#{amount})")
    public void insert(Orders orders);

    @Select("select * from orders where id = #{id}")
    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "orderType",column = "order_type"),
            @Result(property = "customerId",column = "customer_id"),
            @Result(property = "amount",column = "amount")
    })
    public Orders selectOne(Long id);

    @Select("select * from orders where id in(#{ids}) ")
    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "orderType",column = "order_type"),
            @Result(property = "customerId",column = "customer_id"),
            @Result(property = "amount",column = "amount")
    })
    List<Orders> selectById(Long... ids);
}
